/**
 * @Author: Bobby
 * @Date: 2022-02-21 09:37:50
 * @LastEditTime: 2022-03-10 10:15:13
 * @LastEditors: Bobby
 * @Description:
 * @FilePath: \wms-v2\src\project\bobby\store\diyTable.js
 * @CIMC-V2
 */

const state = () => ({
  interactionName: '',
  tableColumnsModal: false, //表头编辑弹框
  tableColumnsSwitchModal: false,
  tableColumnsSwitchItem: {},

  tableEventModal: false, //表格行事件弹框
  tableEventOptions: {}, //表格行事件弹框
  //table menu
  tableMenuConfigModal: false, //表格右键菜单弹框
  tableColumnStatusConfigModal: false, //表格行/列状态配置
  tableMenuList: [], //菜单列表
  tableMenuSelect: {}, //选择交互的菜单
  tableColumnConfigList: [], // 表格行/列状态配置
  tableColumnConfigSelect: [],
  //table interaction
  tableInteractionModal: false,
  //table Operate menu
  tableOperateMenuConfigModal: false, //表格右键菜单弹框
  tableOperateMenuList: [], //菜单列表
  tableOperateMenuSelect: {}, //选择交互的菜单
  tableEditRulesModal: false,
  tableEditDefaultModal: false,
  tableEditCalculateModal: false,
  // pda得
  tablePdaColumnsModal: false, //pda表头编辑弹框
  tablePdaInteractionModal: false, //pda操作按钮交互
})
const getters = {
  getInteractionName: (state) => state.interactionName,
  //
  getTableColumnsModal: (state) => state.tableColumnsModal,
  getTablePdaColumnsModal: (state) => state.tablePdaColumnsModal,

  getTableMenuConfigModal: (state) => state.tableMenuConfigModal,
  getTableColumnStatusConfigModal: (state) => state.tableColumnStatusConfigModal,
  getTableEventModal: (state) => state.tableEventModal,
  getTableEventOptions: (state) => state.tableEventOptions,
  getTableInteractionModal: (state) => state.tableInteractionModal,
  getTablePdaInteractionModal: (state) => state.tablePdaInteractionModal,

  //menu
  getTableMenuList: (state) => state.tableMenuList,
  getTableMenuSelect: (state) => state.tableMenuSelect,

  // row/column config status
  getTableColumnConfigList: (state) => state.tableColumnConfigList,
  getTableColumnConfigSelect: (state) => state.tableColumnConfigSelect,

  //Operate menu
  getTableOperateMenuList: (state) => state.tableOperateMenuList,
  getTableOperateMenuSelect: (state) => state.tableOperateMenuSelect,
  getTableOperateMenuConfigModal: (state) => state.tableOperateMenuConfigModal,
  getTableEditRulesModal: (state) => state.tableEditRulesModal,
  getTableEditDefaultModal: (state) => state.tableEditDefaultModal,
  getTableEditCalculateModal: (state) => state.tableEditCalculateModal,
  getTableColumnsSwitch: (state) => state.tableColumnsSwitchModal,
  getTableColumnsSwitchItem: (state) => state.tableColumnsSwitchItem,
}
const mutations = {
  tableColumnsModalSwitch(state) {
    state.tableColumnsModal = !state.tableColumnsModal
  },
  tablePdaColumnsModalSwitch(state) {
    state.tablePdaColumnsModal = !state.tablePdaColumnsModal
  },
  tableColumnsSwitch(state) {
    console.log(111111111)
    state.tableColumnsSwitchModal = !state.tableColumnsSwitchModal
  },
  setTableColumnsSwitchItem(state, item) {
    state.tableColumnsSwitchItem = item
  },
  tableEventModalSwitch(state, data) {
    state.tableEventOptions = data
    state.tableEventModal = !state.tableEventModal
  },
  //交互-弹框开关
  tableInteractionModalSwitch(state, type = '') {
    state.interactionName = type
    state.tableInteractionModal = !state.tableInteractionModal
  },
  tablePdaInteractionModalSwitch(state, type = '') {
    state.interactionName = type
    state.tablePdaInteractionModal = !state.tablePdaInteractionModal
  },

  //menu
  tableMenuConfigModalSwitch(state) {
    state.tableMenuConfigModal = !state.tableMenuConfigModal
  },
  tableColumnStatusConfigModalSwitch(state) {
    state.tableColumnStatusConfigModal = !state.tableColumnStatusConfigModal
  },
  setTableMenuList(state, data) {
    state.tableMenuList = data
  },
  setTableMenuSelect(state, item) {
    state.tableMenuSelect = item
  },
  setTableColumnConfigList(state, data) {
    state.tableColumnConfigList = data
  },
  setTableColumnConfigSelect(state, item) {
    state.tableColumnConfigSelect = item
  },
  //Operate menu
  tableOperateMenuConfigModalSwitch(state) {
    state.tableOperateMenuConfigModal = !state.tableOperateMenuConfigModal
  },
  setTableOperateMenuList(state, data) {
    state.tableOperateMenuList = data
  },
  setTableOperateMenuSelect(state, item) {
    state.tableOperateMenuSelect = item
  },
  setTableEditRulesModal(state) {
    state.tableEditRulesModal = !state.tableEditRulesModal
  },
  setTableEditDefaultModal(state) {
    state.tableEditDefaultModal = !state.tableEditDefaultModal
  },
  setTableEditCalculateModal(state) {
    state.tableEditCalculateModal = !state.tableEditCalculateModal
  },
}
const actions = {
  tableColumnsModalSwitch({ commit }) {
    commit('tableColumnsModalSwitch')
  },
  tableEventModalSwitch({ commit }, data) {
    commit('tableEventModalSwitch', data)
  },
  tableInteractionModalSwitch({ commit }, type) {
    commit('tableInteractionModalSwitch', type)
  },
  tableColumnsSwitch({ commit }) {
    commit('tableColumnsSwitch')
  },
  setTableColumnsSwitchItem({ commit }, item) {
    commit('setTableColumnsSwitchItem', item)
  },

  //menu
  tableMenuConfigModalSwitch({ commit }) {
    commit('tableMenuConfigModalSwitch')
  },
  tableColumnStatusConfigModalSwitch({ commit }) {
    commit('tableColumnStatusConfigModalSwitch')
  },
  setTableMenuList({ commit }, data) {
    commit('setTableMenuList', data)
  },
  setTableMenuSelect({ commit }, item) {
    commit('setTableMenuSelect', item)
  },
  setTableColumnConfigSelect({ commit }, item) {
    commit('setTableColumnConfigSelect', item)
  },
  setTableColumnConfigList({ commit }, data) {
    commit('setTableColumnConfigList', data)
  },
  //Operate menu
  tableOperateMenuConfigModalSwitch({ commit }) {
    commit('tableOperateMenuConfigModalSwitch')
  },
  setTableOperateMenuList({ commit }, data) {
    commit('setTableOperateMenuList', data)
  },
  setTableOperateMenuSelect({ commit }, item) {
    commit('setTableOperateMenuSelect', item)
  },
  setTableEditRulesModal({ commit }) {
    commit('setTableEditRulesModal')
  },
  setTableEditDefaultModal({ commit }) {
    commit('setTableEditDefaultModal')
  },
  setTableEditCalculateModal({ commit }) {
    commit('setTableEditCalculateModal')
  },
  // PDA
  tablePdaInteractionModalSwitch({ commit }, type) {
    commit('tablePdaInteractionModalSwitch', type)
  },
  tablePdaColumnsModalSwitch({ commit }) {
    commit('tablePdaColumnsModalSwitch')
  },
}
export default { state, getters, mutations, actions }
